Repository navigation
fix(common-utils): apply Map KV items rewrite to toString()-wrapped filter keys - #3826
Conversation
…ilter keys Ad hoc and dashboard filters render Map keys as toString(Map['k']), which the has(<items>, ...) rewrite skipped, so these filters decoded the whole Map for every row instead of using the text index.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 89ac7ec The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Additional context: touches the query rendering engine lightly (21 lines, under the 150-line bar for Tier 4) Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review✅ No issues found. |
Deep Review✅ No critical issues found. This is a tightly-scoped change: a single
🔵 P3 nitpicks (1)
Reviewers (7): correctness, testing, maintainability, project-standards, kieran-typescript, security, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results✅ All tests passed • 476 passed • 1 skipped • 1063s
Tests ran across 4 shards in parallel. |
Summary
Ad hoc and dashboard dropdown filters on a Map key now use the KV items text index, like the same condition written in Lucene or in the SQL
where.rewriteSqlFilterWithKvItemsnow unwraps a single-argumenttoString(...)on the left of=/INbefore matchingMap['k']. Ad hoc and dropdown filters wrap every key intoString(), so the rewrite was skipped and ClickHouse decoded the whole Map for every row.toString()does not change results: the rewrite only applies to maps with a registered KV items column, whose values are already strings.toString, and differently cased names are left unchanged.$__filtersin raw SQL tiles still skips the rewrite; that is a separate follow-up.How to reproduce
Starting point:
yarn dev, registered and logged in. The seededotel_logstable has theLogAttributeItemscolumn andidx_log_attr_itemstext index, and the dev app and API log their own activity to it, with keys such asLogAttributes['teamName'].On
main:LogAttributes['teamName'],=, and your team name.toString(LogAttributes['teamName']) = '<team>'.On this branch:
has(`LogAttributeItems`, concat('teamName', '=', '<team>')).LogAttributes['teamName']for Logs, and select your team. The WHERE clause containshas(`LogAttributeItems`, concat('teamName', '=', '<team>'))instead oftoString(LogAttributes['teamName']) IN ('<team>').References
where)